<template>

	<view>
		<scroll-view :scroll-y="true" @scrolltolower="scrollBottom">
			<view class="personlist" v-for="(item,i) in fansdata">
				<person :data='item' :concern='concern'>
				</person>
			</view>
			<uni-load-more :status="scrollInfo.loading"></uni-load-more>
		</scroll-view>
	</view>
</template>

<script lang="ts" setup>
	import { ref, onMounted, reactive } from 'vue'
	import Person from '../../components/BasePerson/person.vue'
	import { GetFans } from '../../apis/user'
	import userStore from '../../store/modules/user'
	const useStore = userStore();
	const concern = '关注';
	let fansdata = ref()
	let page = ref('1')
	let limit = ref('10')
	const scrollInfo = reactive({
		loading: "more",
	})

	onMounted(() => {
		GetFansData()
	})

	const GetFansData = async function () {
		const data = {
			user_id: useStore.user_id,
			page: page.value,
			limit: limit.value
		}
		try {
			const res = await GetFans(data);
			fansdata.value = res.data
			console.log(fansdata.value);
		} catch (error) {
			// 错误处理逻辑
			console.error('An error occurred while executing Captcha function:', error);
		}
	}


	function scrollBottom() {
		console.log("滚动到底部!");
		page.value = (parseInt(page.value) + 1).toString();
		scrollInfo.loading = "loading";
		GetFansData();
	}
</script>

<style lang="scss">

</style>